<?php defined('IN_YuLin') || exit('NO PERMIT!'); ?>
{template index/header}
<style>
.td-span{
	border: 1px solid #d3dbde;
    border-radius: 3px;
    color: #666;
    cursor: pointer;
    display: inline-block !important;
    margin-left:10px;
    width: 63px !important;
    text-align: center;
}
.on{
	color: #666;
	padding:2px;
}
.on:hover{
  	cursor: pointer;
	text-decoration:underline;
  }
</style>


    <div class="subnav">
        <a href="">首页</a> &gt; <a href="">系统管理</a> &gt; <a href="">域名管理</a>
    </div>
    <div class="main-inner">
        <div class="x-body">
    		<form name="searchform" class="layui-form" action="?m=system&c=binddomain&a=search" method="post" >
                <div class="tablefilter">
                	<div class="tablebutton">
                        <a href="?m=system&c=domain_add" class=""><i class="fa fa-plus"></i>新增</a>
                        <a href="javascript:void(0);" class="chooseAll"><i class="fa fa-check"></i>全选</a>
                        <a href="javascript:void(0);" class="delete"><i class="fa fa-trash"></i>删除</a>      
                    </div>
                    <em>网站</em>
                    <div class="left margin-l10">
                        <select name="upuid">
        					<option value="0">全部</option>
                            <option value="1">前台</option>
        					<option value="2">后台</option>
        				</select>
                    </div>
                    <div class="tableFilterInput">
                        <em>网址</em><input type="text" name="searchUrl">
                    </div>
                    <div class="tableButton">
                        <input type="submit" name="search" class="layui-btn searchBtn" value="查询">
                    </div>
                </div>
        	</form>
            <table class="layui-table">
                <thead>
                    <tr>
                        <th>选择</th>
                        <th>网址</th>
                        <th>备注</th>
                        <th>添加时间</th>
                    </tr>
                </thead>
                <tbody id="datalist">
                    {loop $data as $k=>$v}
                        <tr>
                            <td>
                                <input type="checkbox" name="ids[{$k}]" class="del" value="{$v['id']}" />
                            </td>
                            <td>{$v['url']}</td>
                            <td>{$v['remark']}</td>
                        	<td>{date("Y-m-d H:i:s",$v['inputtime'])}</td>
                        </tr>
                    {/loop}
                </tbody>
            </table>
            <div class="formbox fix" style="margin-left:20px;">
				<a class="formBtn active">保存</a>
				<a class="formBtn">还原</a>
			</div>
            <div class="layui-clear">
                <div id="pages" class="layui-laypage">{$multi}</div>
            </div>
        </div>
    </div>
    <script type="text/javascript">
        $(function(){
            var oBtn = false;
            $(".chooseAll").on('click',function(){
                if(!oBtn){
                    $('input[type=checkbox]').prop('checked',true);
                    oBtn = true;
                }else{
                    $('input[type=checkbox]').prop('checked',false);
                    oBtn = false;
                }
            })
        });

        $(".delete").on('click',function(){
            var ids = [];
            $('input[type=checkbox]:checked').map(function(){
                ids.push($(this).val());
            });
            if(!ids.length){
                alert('当前没有操作的元素');return;
            }
            $.ajaxSetup({async:false});
            $.post("?m=system&c=binddomain&a=delete",{ids:ids},function(res){
                res = eval('('+res+')');
                alert(res.msg);
                $("input[type=checkbox]:checked").parent().parent().remove();
            });
        });
    </script>        
{template index/footer}